<?php
/*** 
 * 描述：常用方法模型
 * @category		
 * @package		Lib			
 * @subpackage	Api.Public	
 * @author		wanght <whtaok@gmail.com>
 * @since		2013-4-17
 * @version		$Id: PublicAction.class.php 3 2013-10-14 02:49:41Z whtaok@gmail.com $
 */

class PublicAction extends Action {
	/**
	 * 描述：省市区三级联动
	 * @access		public
	 * @author		wanght<whtaok@gmail.com>
	 * @since		2013-4-17
	 */
	public function getArea($area_id = -1) {
		$model = D('xle/PublicAreas');
		$mod_where['parent_id'] = $area_id;
        $rtn_data = $model->where($mod_where)->select();
        return $rtn_data;
	}
	/**
	 * 描述：特色分类查询
	 * @access		public
	 * @author		wanght<whtaok@gmail.com>
	 * @since		2013-4-17
	 */	
	public function getCate($cid = 0){
		$model = D('xle/PublicCate');;
		$model->cidForWhere($cid);
		$group_name = $this->_param('group_name');
		$module_name =  $this->_param('module_name');
		$ext_data = array();
		if($group_name){
			$ext_data['group_name'] = $group_name;
		}
		if($module_name){
			$ext_data['module_name'] = $module_name;
		}
		if($ext_data){
			$model->setModWhere($ext_data);
		}
		$list = $model->getModWithWhere()->select();
		$rtn_data = array();
		foreach ($list as $key=>$value){
			$rtn_data[$value['title']][]=$value;
		}
		return $rtn_data;
	}
}

?>